package cn.nicklemay.interview.algorithm;

import java.io.*;
import java.util.*;

public class Subsets
{
    public List<List<Integer>> subsets(int[] S) {
        List<List<Integer>> res = new ArrayList<>();
        res.add(new ArrayList<Integer>());
        for(int i : S) {
            List<List<Integer>> tmp = new ArrayList<>();
            for(List<Integer> sub : res) {
                // 复制数组（浅拷贝）
                List<Integer> a = new ArrayList<>(sub);
                a.add(i);
                tmp.add(a);
            }
            res.addAll(tmp);
        }
        return res;
    }

    public static void main(String[] args) throws IOException
    {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String line;
        while ((line = in.readLine()) != null) {
            int[] nums = IOUtil.stringToIntegerArray(line);

            List<List<Integer>> ret = new Subsets().subsets(nums);

            String out = IOUtil.int2dListToString(ret);

            System.out.print(out);
        }
    }
}
